1919 report generation.
2020"""
2121
22- import pathlib
2322import sys
2423import tkinter as tk
2524
3231customtkinter .set_default_color_theme ("dark-blue" )
3332
3433
35- print (pathlib .Path ("." ).absolute ())
36-
37-
3834# callbacks
3935def create_run_vuegen (is_dir , config_path , report_type , run_streamlit ):
4036 def inner ():
@@ -75,13 +71,16 @@ def radio_button_callback():
7571
7672# APP
7773app = customtkinter .CTk ()
78- app .geometry ("800x600 " )
79- app .title ("CustomTkinter Demo " )
74+ app .geometry ("460x400 " )
75+ app .title ("VueGen GUI " )
8076
77+ ##########################################################################################
8178# Config or directory input
8279ctk_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 )
8584is_dir = tk .IntVar (value = 1 )
8685callback_radio_config = radiobutton_event (is_dir )
8786ctk_radio_config_0 = customtkinter .CTkRadioButton (
@@ -91,37 +90,45 @@ def radio_button_callback():
9190 variable = is_dir ,
9291 value = 0 ,
9392)
94- ctk_radio_config_0 .pack ( pady = 2 )
93+ ctk_radio_config_0 .grid ( row = 1 , column = 0 , padx = 20 , pady = 2 )
9594ctk_radio_config_1 = customtkinter .CTkRadioButton (
9695 app ,
9796 text = "Use dir" ,
9897 command = callback_radio_config ,
9998 variable = is_dir ,
10099 value = 1 ,
101100)
102- ctk_radio_config_1 .pack ( pady = 2 )
101+ ctk_radio_config_1 .grid ( row = 1 , column = 1 , padx = 20 , pady = 2 )
103102
104103config_path = tk .StringVar ()
105104config_path_entry = customtkinter .CTkEntry (
106105 app ,
107106 width = 400 ,
108107 textvariable = config_path ,
109108)
110- config_path_entry .pack (pady = 10 )
111-
109+ config_path_entry .grid (row = 2 , column = 0 , columnspan = 2 , padx = 20 , pady = 10 )
112110
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 )
113118report_type = tk .StringVar (value = report_types [0 ])
114119report_dropdown = customtkinter .CTkOptionMenu (
115120 app ,
116121 values = report_types ,
117122 variable = report_type ,
118123 command = optionmenu_callback ,
119124)
120- report_dropdown .pack ( pady = 20 )
125+ report_dropdown .grid ( row = 4 , column = 0 , columnspan = 2 , padx = 20 , pady = 20 )
121126
122127_report_type = report_dropdown .get ()
123128print ("report_type value:" , _report_type )
124129
130+ ##########################################################################################
131+ # Run Streamlit radio button
125132run_streamlit = tk .IntVar (value = 0 )
126133callback_radio_st_run = radiobutton_event (run_streamlit )
127134ctk_radio_st_autorun_1 = customtkinter .CTkRadioButton (
@@ -131,22 +138,26 @@ def radio_button_callback():
131138 variable = run_streamlit ,
132139 command = callback_radio_st_run ,
133140)
134- ctk_radio_st_autorun_1 .pack ( pady = 2 )
141+ ctk_radio_st_autorun_1 .grid ( row = 5 , column = 0 , padx = 20 , pady = 20 )
135142ctk_radio_st_autorun_0 = customtkinter .CTkRadioButton (
136143 app ,
137144 text = "skip starting streamlit" ,
138145 value = 0 ,
139146 variable = run_streamlit ,
140147 command = callback_radio_st_run ,
141148)
142- ctk_radio_st_autorun_0 .pack ( pady = 2 )
149+ ctk_radio_st_autorun_0 .grid ( row = 5 , column = 1 , padx = 20 , pady = 20 )
143150
151+ ##########################################################################################
152+ # Run VueGen button
144153run_vuegen = create_run_vuegen (is_dir , config_path , report_type , run_streamlit )
145154run_button = customtkinter .CTkButton (
146155 app ,
147156 text = "Run VueGen" ,
148157 command = run_vuegen ,
149158)
150- run_button .pack ( pady = 20 )
159+ run_button .grid ( row = 6 , column = 0 , columnspan = 2 , padx = 20 , pady = 20 )
151160
161+ ##########################################################################################
162+ # Run the app in the mainloop
152163app .mainloop ()
0 commit comments