JonB
I find that I misunderstood Keycommand, so i try to add subview.
Tkank you for reply my asking.
Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Posts made by MOD0
-
RE: Use Keycommand in conjunction with superview and pyui.
-
Use Keycommand in conjunction with superview and pyui.
Hi, i wrote code in order to use my program with Bluetooth keyboard.(some part quoted from here)
I succeeded in some print code(pleases press the D key in your bluetooth-keyboard).
But when I press A (i expected label show me Pusshed-A)
only called that messageAttributeError (Line-35)
Alabel = sender.superview['Alabel']
AttributeError: 'int' object has no attribute 'superview'How do i use Keycommand with superview?
code is here(Please make FC.pyui)
(FC.pyui include label. label name is Alabel)from objc_util import * import ui UIKeyCommand = ObjCClass('UIKeyCommand') modifiers = {(1<<17): 'Shift', (1<<18): 'Ctrl', (1<<19): 'Alt', (1<<20): 'Cmd', (1<<21): 'NumPad'} def keyCommands(_self, _cmd): cmd_key_flag = (1<<20) key_a = UIKeyCommand.keyCommandWithInput_modifierFlags_action_('A', 0,'keyCommandAction:') key_s = UIKeyCommand.keyCommandWithInput_modifierFlags_action_('S', 0, 'keyCommandAction:') key_d = UIKeyCommand.keyCommandWithInput_modifierFlags_action_('D', 0, 'keyCommandAction:') commands = ns([key_a, key_s, key_d]) return commands.ptr def canBecomeFirstResponder(_self, _cmd): return True def keyCommandAction_(_self, _cmd, sender): self = ObjCInstance(_self) key_cmd = ObjCInstance(sender) flags = key_cmd.modifierFlags() modifier_str = ' + '.join(modifiers[m] for m in modifiers.keys() if (m & flags)) key_input = key_cmd.input() print 'Input: "%s" Modifiers: %s' % (key_input, modifier_str) if str(key_input) == 'A': A(sender) elif str(key_input) == 'S': S(sender) else: D(sender) def A(sender): Alabel = sender.superview['Alabel'] Alabel.text = str('Pusshed-A') def S(sender): print('pusshed-S') def D(sender): print('pusshed-D') FCCF = create_objc_class('FCCF', UIView, [keyCommands, canBecomeFirstResponder, keyCommandAction_]) main_view = ui.load_view('FC') v = FCCF.alloc().initWithFrame_(((0, 0), (1, 1))) v.becomeFirstResponder() ObjCInstance(main_view).addSubview_(v) main_view.present('sheet')
-
RE: How do I Change color of top bar?
@lachlantula
Thanks for tell me that add subview with changing bar_color.
I learned python grammar which i didn't know until now.@JonB
Thanks for tell me the :URL.
I achieve my objective that changing bar_color when running program without change or add subview.for everyone who answered my asking
Thank you for answering my question, and
I thank you for reading it through.
By now, I guess you get used to my funny English writing. -
RE: How do I Change color of top bar?
@bennr01 said:
title_bar_color to View.present().
Tkanks for tell that, I became capable of change default bar_color.
i pleased.but, how can i change "title_bar_color" when running program like when change "background_color" ,(for example label,button,,,).
for example i want change "title_bar_color" like that
- red (when start progrum)
↓
- blue ( when "button1 = sender.superview['button1']" pushed)
↓↑
- green ( when "button2 = sender.superview['button2']" pushed)
-
How do I Change color of top bar?
Hi, I’ve recently started pythonista for iOS.
And I don't know how i change color of top bar.
I don't know its bar name exact, so i decided to ask here.
Please look at the image
http://i.imgur.com/ru9o49j.pngI mean I want to change color that space(bar?) , can i do that?
or Please help me on how to full space when ran myself gui program.
like this example game program. http://i.imgur.com/lNExnah.pngThank you for reading.