@@ -1224,10 +1224,7 @@ def __del__(self):
12241224# ---------------------------------------------------------------------- #
12251225class Button (Element ):
12261226 def __init__ (self , button_text = '' , button_type = BUTTON_TYPE_READ_FORM , target = (None , None ), tooltip = None ,
1227- file_types = (("ALL Files" , "*.*" ),), initial_folder = None , disabled = False , image_filename = None ,
1228- image_data = None , image_size = (None , None ), image_subsample = None , border_width = None , size = (None , None ),
1229- auto_size_button = None , button_color = None , font = None , bind_return_key = False ,
1230- focus = False , pad = None , key = None ):
1227+ file_types = (("ALL Files" , "*.*" ),), initial_folder = None , disabled = False , change_submits = False , image_filename = None , image_data = None , image_size = (None , None ), image_subsample = None , border_width = None , size = (None , None ), auto_size_button = None , button_color = None , font = None , bind_return_key = False , focus = False , pad = None , key = None ):
12311228 '''
12321229 Button Element
12331230 :param button_text:
@@ -1271,6 +1268,7 @@ def __init__(self, button_text='', button_type=BUTTON_TYPE_READ_FORM, target=(No
12711268 self .DefaultDate_M_D_Y = (None , None , None )
12721269 self .InitialFolder = initial_folder
12731270 self .Disabled = disabled
1271+ self .ChangeSubmits = change_submits
12741272
12751273 super ().__init__ (ELEM_TYPE_BUTTON , size = size , font = font , pad = pad , key = key , tooltip = tooltip )
12761274 return
@@ -1530,7 +1528,7 @@ def __init__(self, filename=None, data=None, background_color=None, size=(None,
15301528 tooltip = tooltip )
15311529 return
15321530
1533- def Update (self , filename = None , data = None ):
1531+ def Update (self , filename = None , data = None , size = ( None , None ) ):
15341532 if filename is not None :
15351533 image = tk .PhotoImage (file = filename )
15361534 elif data is not None :
@@ -1543,9 +1541,8 @@ def Update(self, filename=None, data=None):
15431541 # image = data
15441542 else :
15451543 return
1546- width , height = image .width (), image .height ()
1544+ width , height = size [ 0 ] or image .width (), size [ 1 ] or image .height ()
15471545 self .tktext_label .configure (image = image , width = width , height = height )
1548- # self.tktext_label.configure(image=image)
15491546 self .tktext_label .image = image
15501547
15511548 def __del__ (self ):
@@ -3223,46 +3220,45 @@ def __del__(self):
32233220
32243221# ------------------------- FOLDER BROWSE Element lazy function ------------------------- #
32253222def FolderBrowse (button_text = 'Browse' , target = (ThisRow , - 1 ), initial_folder = None , tooltip = None , size = (None , None ),
3226- auto_size_button = None , button_color = None , disabled = False , font = None , pad = None , key = None ):
3223+ auto_size_button = None , button_color = None , disabled = False , change_submits = False , font = None , pad = None , key = None ):
32273224 return Button (button_text = button_text , button_type = BUTTON_TYPE_BROWSE_FOLDER , target = target ,
32283225 initial_folder = initial_folder , tooltip = tooltip , size = size , auto_size_button = auto_size_button ,
3229- disabled = disabled , button_color = button_color , font = font , pad = pad , key = key )
3226+ disabled = disabled , button_color = button_color ,change_submits = change_submits , font = font , pad = pad , key = key )
32303227
32313228
32323229# ------------------------- FILE BROWSE Element lazy function ------------------------- #
32333230def FileBrowse (button_text = 'Browse' , target = (ThisRow , - 1 ), file_types = (("ALL Files" , "*.*" ),), initial_folder = None ,
3234- tooltip = None , size = (None , None ), auto_size_button = None , button_color = None , font = None , disabled = False ,
3231+ tooltip = None , size = (None , None ), auto_size_button = None , button_color = None , change_submits = False , font = None , disabled = False ,
32353232 pad = None , key = None ):
32363233 return Button (button_text = button_text , button_type = BUTTON_TYPE_BROWSE_FILE , target = target , file_types = file_types ,
3237- initial_folder = initial_folder , tooltip = tooltip , size = size , auto_size_button = auto_size_button ,
3238- disabled = disabled , button_color = button_color , font = font , pad = pad , key = key )
3234+ initial_folder = initial_folder , tooltip = tooltip , size = size , auto_size_button = auto_size_button , change_submits = change_submits , disabled = disabled , button_color = button_color , font = font , pad = pad , key = key )
32393235
32403236
32413237# ------------------------- FILES BROWSE Element (Multiple file selection) lazy function ------------------------- #
32423238def FilesBrowse (button_text = 'Browse' , target = (ThisRow , - 1 ), file_types = (("ALL Files" , "*.*" ),), disabled = False ,
3243- initial_folder = None , tooltip = None , size = (None , None ), auto_size_button = None , button_color = None ,
3239+ initial_folder = None , tooltip = None , size = (None , None ), auto_size_button = None , button_color = None , change_submits = False ,
32443240 font = None , pad = None , key = None ):
32453241 return Button (button_text = button_text , button_type = BUTTON_TYPE_BROWSE_FILES , target = target , file_types = file_types ,
3246- initial_folder = initial_folder , tooltip = tooltip , size = size , auto_size_button = auto_size_button ,
3242+ initial_folder = initial_folder ,change_submits = change_submits , tooltip = tooltip , size = size , auto_size_button = auto_size_button ,
32473243 disabled = disabled , button_color = button_color , font = font , pad = pad , key = key )
32483244
32493245
32503246# ------------------------- FILE BROWSE Element lazy function ------------------------- #
32513247def FileSaveAs (button_text = 'Save As...' , target = (ThisRow , - 1 ), file_types = (("ALL Files" , "*.*" ),), initial_folder = None ,
3252- disabled = False , tooltip = None , size = (None , None ), auto_size_button = None , button_color = None , font = None ,
3248+ disabled = False , tooltip = None , size = (None , None ), auto_size_button = None , button_color = None , change_submits = False , font = None ,
32533249 pad = None , key = None ):
32543250 return Button (button_text = button_text , button_type = BUTTON_TYPE_SAVEAS_FILE , target = target , file_types = file_types ,
32553251 initial_folder = initial_folder , tooltip = tooltip , size = size , disabled = disabled ,
3256- auto_size_button = auto_size_button , button_color = button_color , font = font , pad = pad , key = key )
3252+ auto_size_button = auto_size_button , button_color = button_color , change_submits = change_submits , font = font , pad = pad , key = key )
32573253
32583254
32593255# ------------------------- SAVE AS Element lazy function ------------------------- #
32603256def SaveAs (button_text = 'Save As...' , target = (ThisRow , - 1 ), file_types = (("ALL Files" , "*.*" ),), initial_folder = None ,
3261- disabled = False , tooltip = None , size = (None , None ), auto_size_button = None , button_color = None , font = None ,
3257+ disabled = False , tooltip = None , size = (None , None ), auto_size_button = None , button_color = None , change_submits = False , font = None ,
32623258 pad = None , key = None ):
32633259 return Button (button_text = button_text , button_type = BUTTON_TYPE_SAVEAS_FILE , target = target , file_types = file_types ,
32643260 initial_folder = initial_folder , tooltip = tooltip , size = size , disabled = disabled ,
3265- auto_size_button = auto_size_button , button_color = button_color , font = font , pad = pad , key = key )
3261+ auto_size_button = auto_size_button , button_color = button_color , change_submits = change_submits , font = font , pad = pad , key = key )
32663262
32673263
32683264# ------------------------- SAVE BUTTON Element lazy function ------------------------- #
@@ -4697,7 +4693,7 @@ def StartupTK(my_flex_form):
46974693 _my_windows .hidden_master_root = tk .Tk ()
46984694 _my_windows .hidden_master_root .attributes ('-alpha' , 0 ) # hide window while building it. makes for smoother 'paint'
46994695 _my_windows .hidden_master_root .wm_overrideredirect (True )
4700-
4696+ _my_windows . hidden_master_root . withdraw ()
47014697 # root = tk.Tk() # users windows are no longer using tk.Tk. They are all Toplevel windows
47024698 root = tk .Toplevel ()
47034699 else :
@@ -6663,8 +6659,9 @@ def main():
66636659 [Text ('Destination Folder' , size = (15 , 1 ), justification = 'right' ), InputText ('Dest' ), FolderBrowse ()],
66646660 [Ok (), Cancel ()]]
66656661
6666- button , values = Window ('Demo window..' ).Layout (layout ).Read ()
6667-
6662+ window = Window ('Demo window..' ).Layout (layout )
6663+ event , values = window .Read ()
6664+ window .Close ()
66686665
66696666if __name__ == '__main__' :
66706667 main ()
0 commit comments