@Ti-Leyon I saw the title, GAP, but I didn't know it is the visual interface designer! I have tried it. Although it currently lacks the graphical way of editing attributes, it is a great work. I would definitely use UniPAGe and GAP if my code needs to run on several platforms. Thanks for your hard work.
@zrzka Thank you for your supporting reply. This could benefit lots of people like you and me in the future, though it is in a nascent stage right now. I only checked Labels, TextField, Button, and the Button's action that just copies the TextField's content into Label object's text when it is clicked. If the module code goes public, we all can develop together in a faster way. However, I guess that needs @omz's permission because, as far as I know, ui.py in Pythonista belongs to them.
@mikael Hello. I've never used custom view before. But while I was working on this module, I saw several lines of code regarding custom view and custom attributes in the very function I modified. After I created a custom view on Pythonista UI editing interface and glanced its attributes, I am optimistic about it. You might want to look at ui.py in Pythonista.
(Standard Library -> site-packages -> ui.py)
As the title suggests, I started to write ui module on desktop which bridges between ui.py on Pythonista and kivy on desktop.
To give you an idea, here's a sample python script that's working on both Pythonista and desktop.
(I will omit .pyui since it's too long and unimportant here)
import ui def button_tapped(sender): '@type sender: ui.Button' # Get the button's title for the following logic: t = sender.title global shows_result # Get the labels: label_sentence = sender.superview['label_sentence'] input_sentence = sender.superview['input_sentence'] label_answer = sender.superview['label_answer'] if t == 'Check': label_answer.text = input_sentence.text v = ui.load_view() label_sentence = v['label_sentence'] input_sentence = v['input_sentence'] label_answer = v['label_answer'] label_sentence.text = 'test' v.present('sheet')
I can't run this script on desktop because there is no ui module.
So, I wrote ui.py that internally calls kivy.
it's working with Button(along with its action function), Label, TextField classes so far.
Q) My code is based on ui.py from Pythonista. Can I upload my code to a public repository such as github?
I'm aware of the fact that there are similar topics on this forum.
However, I couldn't find the way to meet my goal: run scripts with .pyui on desktop without ANY modification
UniPAGe has a great advantage that it can run on five major platforms with almost identical visuals, but with no disrespect, it has a disadvantage that one has to write the script with it from the start. Also, I think it deprives Pythonista of its great UI editing ability since a variety of attributes including the position and size have to be hard-coded inside the script.
-> UniPAGe now has a visual interface designer. Check it out here
One might think what I'm trying to achieve is a little bit odd because ui module is not universal--it could be only used in Pythonista.
I am a software engineer and python is not my main language.
If I use python, that would be mainly on Pythonista.
Occasionally, I would like to run it on desktop too.
My work will minimize inconvenience to such a job.
I can say I am almost new to python.
So, things I understood and mentioned above could be wrong.
I would appreciate if you correct me.