Hi,
I didn‘t programm for a long time now, and just started with Python last week, because I missed programming and wanted to try something new.
Now after planning my first project, I decided to start with a simple UI, and thought it should be done fairly quick.
This is what my created UI-file looks like:
https://ibb.co/xCq2k9p
And this is my script:
import ui
data1 = ['Item_A', 'Item_B', 'Item_C', 'Item_D']
data2 = ['Item_E', 'Item_F']
def button1_pressed(button1):
print('Button1 pressed.')
def loc_selection(segmentedcontrol1):
if button2.selected_index == 0:
print('Segment A')
data = data1
view['tableview1'].data_source.items = data
elif button2.selected_index == 1:
print('Segment B')
data = data2
view['tableview1'].data_source.items = data
def list_item_clicked(tableview1):
print('Item selected.')
view = ui.load_view('test_01')
view.name = 'Test 01'
data = data1
view['tableview1'].data_source.items = data
button2 = view['segmentedcontrol1']
loc_selection('segmentedcontrol1')
view.present('sheet')
It’s a really simple thing probably, but it really was a challenge for me to get this done so far :D
My problem now: I want to run a specific function if a list item is selected and I can‘t find a way how to do it.
I would be really greatful for any help!
Best regards
