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.
How to get a object value from custom view class
-
Hello, all pythonista in the world.
I'm making a sample program which tests touch_began() and touch_end() methods by using custom view object on pyui file.
I implemented MyView class in python file and touch methods worked well(Following program).
If I put a label object on the pyui file, how can I get a value of label object in touch method?import ui
class MyView (ui.View):
def touch_began(self, touch):
print('touch')def touch_ended(self, touch): print('end')
v1 =ui.load_view('touch')
v1.present(style = 'full_screen', orientations = ['landscape'])As I told, touch.pyui has a cutom view object connected to MyView class and label object. I want to print label object's text value when touch_began() is called. Could you please tell me how to implement?
-
print(v1['label1'].text)
-
@cvp Thank you so much!