19
19
report generation.
20
20
"""
21
21
22
- import pathlib
23
22
import sys
24
23
import tkinter as tk
25
24
32
31
customtkinter .set_default_color_theme ("dark-blue" )
33
32
34
33
35
- print (pathlib .Path ("." ).absolute ())
36
-
37
-
38
34
# callbacks
39
35
def create_run_vuegen (is_dir , config_path , report_type , run_streamlit ):
40
36
def inner ():
@@ -75,13 +71,16 @@ def radio_button_callback():
75
71
76
72
# APP
77
73
app = customtkinter .CTk ()
78
- app .geometry ("800x600 " )
79
- app .title ("CustomTkinter Demo " )
74
+ app .geometry ("460x400 " )
75
+ app .title ("VueGen GUI " )
80
76
77
+ ##########################################################################################
81
78
# Config or directory input
82
79
ctk_label_config = customtkinter .CTkLabel (
83
- app , text = "Add path to config file or directory. Select radio button accordingly"
84
- ).pack (pady = 2 )
80
+ app ,
81
+ text = "Add path to config file or directory. Select radio button accordingly" ,
82
+ )
83
+ ctk_label_config .grid (row = 0 , column = 0 , columnspan = 2 , padx = 20 , pady = 20 )
85
84
is_dir = tk .IntVar (value = 1 )
86
85
callback_radio_config = radiobutton_event (is_dir )
87
86
ctk_radio_config_0 = customtkinter .CTkRadioButton (
@@ -91,37 +90,45 @@ def radio_button_callback():
91
90
variable = is_dir ,
92
91
value = 0 ,
93
92
)
94
- ctk_radio_config_0 .pack ( pady = 2 )
93
+ ctk_radio_config_0 .grid ( row = 1 , column = 0 , padx = 20 , pady = 2 )
95
94
ctk_radio_config_1 = customtkinter .CTkRadioButton (
96
95
app ,
97
96
text = "Use dir" ,
98
97
command = callback_radio_config ,
99
98
variable = is_dir ,
100
99
value = 1 ,
101
100
)
102
- ctk_radio_config_1 .pack ( pady = 2 )
101
+ ctk_radio_config_1 .grid ( row = 1 , column = 1 , padx = 20 , pady = 2 )
103
102
104
103
config_path = tk .StringVar ()
105
104
config_path_entry = customtkinter .CTkEntry (
106
105
app ,
107
106
width = 400 ,
108
107
textvariable = config_path ,
109
108
)
110
- config_path_entry .pack (pady = 10 )
111
-
109
+ config_path_entry .grid (row = 2 , column = 0 , columnspan = 2 , padx = 20 , pady = 10 )
112
110
111
+ ##########################################################################################
112
+ # Report type dropdown
113
+ ctk_label_report = customtkinter .CTkLabel (
114
+ app ,
115
+ text = "Select type of report to generate (use streamlit for now)" ,
116
+ )
117
+ ctk_label_report .grid (row = 3 , column = 0 , columnspan = 2 , padx = 20 , pady = 20 )
113
118
report_type = tk .StringVar (value = report_types [0 ])
114
119
report_dropdown = customtkinter .CTkOptionMenu (
115
120
app ,
116
121
values = report_types ,
117
122
variable = report_type ,
118
123
command = optionmenu_callback ,
119
124
)
120
- report_dropdown .pack ( pady = 20 )
125
+ report_dropdown .grid ( row = 4 , column = 0 , columnspan = 2 , padx = 20 , pady = 20 )
121
126
122
127
_report_type = report_dropdown .get ()
123
128
print ("report_type value:" , _report_type )
124
129
130
+ ##########################################################################################
131
+ # Run Streamlit radio button
125
132
run_streamlit = tk .IntVar (value = 0 )
126
133
callback_radio_st_run = radiobutton_event (run_streamlit )
127
134
ctk_radio_st_autorun_1 = customtkinter .CTkRadioButton (
@@ -131,22 +138,26 @@ def radio_button_callback():
131
138
variable = run_streamlit ,
132
139
command = callback_radio_st_run ,
133
140
)
134
- ctk_radio_st_autorun_1 .pack ( pady = 2 )
141
+ ctk_radio_st_autorun_1 .grid ( row = 5 , column = 0 , padx = 20 , pady = 20 )
135
142
ctk_radio_st_autorun_0 = customtkinter .CTkRadioButton (
136
143
app ,
137
144
text = "skip starting streamlit" ,
138
145
value = 0 ,
139
146
variable = run_streamlit ,
140
147
command = callback_radio_st_run ,
141
148
)
142
- ctk_radio_st_autorun_0 .pack ( pady = 2 )
149
+ ctk_radio_st_autorun_0 .grid ( row = 5 , column = 1 , padx = 20 , pady = 20 )
143
150
151
+ ##########################################################################################
152
+ # Run VueGen button
144
153
run_vuegen = create_run_vuegen (is_dir , config_path , report_type , run_streamlit )
145
154
run_button = customtkinter .CTkButton (
146
155
app ,
147
156
text = "Run VueGen" ,
148
157
command = run_vuegen ,
149
158
)
150
- run_button .pack ( pady = 20 )
159
+ run_button .grid ( row = 6 , column = 0 , columnspan = 2 , padx = 20 , pady = 20 )
151
160
161
+ ##########################################################################################
162
+ # Run the app in the mainloop
152
163
app .mainloop ()
0 commit comments