From c3cc96534d6cbd59945d38c26d2c8dc26317832e Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Tue, 25 Sep 2018 11:26:41 -0400 Subject: [PATCH 1/2] More 2.7 work --- PySimpleGUI27.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/PySimpleGUI27.py b/PySimpleGUI27.py index 7eec6244..bc8858eb 100644 --- a/PySimpleGUI27.py +++ b/PySimpleGUI27.py @@ -1,10 +1,12 @@ #!/usr/bin/python3 -import tkinter as tk -from tkinter import filedialog -from tkinter.colorchooser import askcolor -from tkinter import ttk -import tkinter.scrolledtext as tkst -import tkinter.font +import Tkinter as tk +# import tkinter as tk +import tkFileDialog +import ttk +# from Tkinter.colorchooser import askcolor +# from Tkinter import ttk +# import Tkinter.scrolledtext as tkst +# import Tkinter.font import datetime import sys import textwrap From 07ead47df70a2577dcfbc8af73dbe37c6e7f5205 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Tue, 25 Sep 2018 11:39:30 -0400 Subject: [PATCH 2/2] More 2.7 work --- PySimpleGUI27.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/PySimpleGUI27.py b/PySimpleGUI27.py index bc8858eb..54674cf0 100644 --- a/PySimpleGUI27.py +++ b/PySimpleGUI27.py @@ -3,7 +3,8 @@ import Tkinter as tk # import tkinter as tk import tkFileDialog import ttk -# from Tkinter.colorchooser import askcolor +import tkColorChooser +import tkFont # from Tkinter import ttk # import Tkinter.scrolledtext as tkst # import Tkinter.font @@ -1054,30 +1055,30 @@ class Button(Element): except: pass filetypes = [] if self.FileTypes is None else self.FileTypes if self.BType == BUTTON_TYPE_BROWSE_FOLDER: - folder_name = tk.filedialog.askdirectory(initialdir=self.InitialFolder) # show the 'get folder' dialog box + folder_name = tkFileDialog.askdirectory(initialdir=self.InitialFolder) # show the 'get folder' dialog box if folder_name != '': try: strvar.set(folder_name) self.TKStringVar.set(folder_name) except: pass elif self.BType == BUTTON_TYPE_BROWSE_FILE: - file_name = tk.filedialog.askopenfilename(filetypes=filetypes, initialdir=self.InitialFolder) # show the 'get file' dialog box + file_name = tkFileDialog.askopenfilename(filetypes=filetypes, initialdir=self.InitialFolder) # show the 'get file' dialog box if file_name != '': strvar.set(file_name) self.TKStringVar.set(file_name) elif self.BType == BUTTON_TYPE_COLOR_CHOOSER: - color = tk.colorchooser.askcolor() # show the 'get file' dialog box + color = tkColorChooser.askcolor() # show the 'get file' dialog box color = color[1] # save only the #RRGGBB portion strvar.set(color) self.TKStringVar.set(color) elif self.BType == BUTTON_TYPE_BROWSE_FILES: - file_name = tk.filedialog.askopenfilenames(filetypes=filetypes, initialdir=self.InitialFolder) + file_name = tkFileDialog.askopenfilenames(filetypes=filetypes, initialdir=self.InitialFolder) if file_name != '': file_name = ';'.join(file_name) strvar.set(file_name) self.TKStringVar.set(file_name) elif self.BType == BUTTON_TYPE_SAVEAS_FILE: - file_name = tk.filedialog.asksaveasfilename(filetypes=filetypes, initialdir=self.InitialFolder) # show the 'get file' dialog box + file_name = tkFileDialog.asksaveasfilename(filetypes=filetypes, initialdir=self.InitialFolder) # show the 'get file' dialog box if file_name != '': strvar.set(file_name) self.TKStringVar.set(file_name) @@ -2706,7 +2707,7 @@ def AddMenuItem(top_menu, sub_menu_info, element, is_sub_menu=False, skip=False) def PackFormIntoFrame(form, containing_frame, toplevel_form): def CharWidthInPixels(): - return tkinter.font.Font().measure('A') # single character width + return tkFont.Font().measure('A') # single character width # only set title on non-tabbed forms border_depth = toplevel_form.BorderDepth if toplevel_form.BorderDepth is not None else DEFAULT_BORDER_WIDTH # --------------------------------------------------------------------------- #