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.
Text display help
-
@stephen
Yes, I would like that. Right now is not a super great time, though, as I still have to finish my school year. When I am done with that (in about 10 days), I would love to co-op on it.However, I do have a question. How would I create a pushable button in Pythonista? I know tkinter doesn’t work, since it is designed for computer displays. Tkinter is really the only way I know how to create a button, so I may require some assistance.
-
@Bumbo-Cactoni said:
@stephen
Yes, I would like that. Right now is not a super great time, though, as I still have to finish my school year. When I am done with that (in about 10 days), I would love to co-op on it.However, I do have a question. How would I create a pushable button in Pythonista? I know tkinter doesn’t work, since it is designed for computer displays. Tkinter is really the only way I know how to create a button, so I may require some assistance.
do you mean creating a button within Pythonista's Editor View itself or one in a CustomView fom
ui
or in ascene.Node
? iether way i can help you out im sure.ui
has a built-inui.Button
, For Pythonista's EditorUIView
we would useobjc_util
im sure and for scene ive alredy created ownButtonNode
class that i have in my "cook book" -
import ui v = ui.View() btn = ui.Button( title="Push", flex='RTLB', background_color='grey', tint_color='black' ) def action(sender): sender.title = 'Pushed' btn.action = action btn.width = 200 btn.height = 40 btn.center = (50, 50) v.add_subview(btn) v.present('fullscreen')
-
@Bumbo-Cactoni, to explain the obscure part:
- View v is by default initially sized at 100 x 100 pixels
- So placing the button center at (50, 50) means it is in the center of the view at this point
- Then, because the flex is set to ”Right Top Left Bottom”, i.e. all sides, they will scale with the view, effectively keeping the button in center when the view is presented and scaled to fill the screen
- And it will continue to stay in the center if you e.g. rotate the device
I think the initial size 100 x 100 was chosen at least partly so that if you want, you can think the locations of subviews as percentages.