I have a script with 3 different random number lists.
Depending of witch of the 3 buttons I press , result is printed in shell . (Working)
I then want the result to show in another sg.window.
Now I have the results in 3 different sg.windows .
How can I get the result in just one window?
Any tips for a beginner?
script:
#code
import os
2 import random
3 import PySimpleGUI as sg
4
5 os.chdir("C:/windows/system32/")
6
7 current_dir = r"C:/windows/system32/"
8
9 randomlist1 = []
10 randomlist2 = []
11 randomlist3 = []
12 sg.theme('Purple') # Add a touch of color
13
14 layout = [[sg.Text('WIN$$$$$')],
15 [sg.Button('V86', button_color=('white', 'blue'), key='V86'),
16 sg.Button('LOTTO', button_color=('white', 'green'), key='LOTTO'),
17 sg.Button('V75', button_color=('blue', 'yellow'), key='V75'),
18 sg.Button('4 quit', button_color=('red', 'black'), key='4 quit')]]
19
20 window = sg.Window('Var god välj spelform!', layout, )
21
22 while True:
23 event, values = window.read()
24
25 if event == sg.WIN_CLOSED:
26 break
27 elif event == 'V86':
28 randomlist1 = random.sample(range(1, 18), 8)
29 print(randomlist1, ('V86'))
30
31
32 elif event == 'LOTTO':
33 randomlist2 = random.sample(range(1, 35), 7)
34 print(randomlist2, ('LOTTO'))
35
36
37 elif event == 'V75':
38 randomlist3 = random.sample(range(1, 18), 7)
39 print(randomlist3, ('V75'))
40
41 elif event == '4 quit':
42 break
43
44 window.close()
45
46 layout = [[sg.Text('V 8 6')],
47 [sg.InputText(randomlist1, )],
48 [sg.Cancel()]]
49
50 window = sg.Window('$$$$$$', layout)
51
52 event, values = window.read()
53 window.close()
54
55 layout = [[sg.Text('LOTTO')],
56 [sg.InputText(randomlist2)],
57 [sg.Cancel()]]
58
59 window = sg.Window('€€€€€€', layout)
60
61 event, values = window.read()
62
63 window.close()
64
65 layout = [[sg.Text('V 7 5')],
66 [sg.InputText(randomlist3)],
67 [sg.Cancel()]]
68
69 window = sg.Window('£££££', layout)
70
71 event, values = window.read()
72
73 window.close()
74
````end