@cvp that was exactly what I needed. I thought label is what should be used but had no success sending my string. Turns out I was only missing the .text - Thank you!
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.
Latest posts made by cjohnson32
-
RE: Cannot assign string to object in ui
-
Cannot assign string to object in ui
Hi all,
I’m extremely new to python and coding in general. I am trying to create a fairly simple app to clock in and out for work purposes. I have the ui show my “time card” which I want to have a running digital clock at the top of the screen. I can get the time and have it update every second but am having issues sending the string to an (any) object in my ui. Perhaps I’m not using the correct object to display my string or not using the correct code to send it. The error I keep getting is “ui.View” object does not support item assignment. My code looks something like this:
import ui import time def change_view(sender): '@type sender: ui.Button' #get button name: b = sender.name v = ui.load_view(b) return v.present() @ui.in_background def update_time(): while True: time.sleep(1) v1['clock_view'] = time.strftime('%r') v1 = ui.load_view('time_card') update_view() v1.present() ```