More 2.7 work

This commit is contained in:
MikeTheWatchGuy 2018-09-25 11:39:30 -04:00
parent c3cc96534d
commit 07ead47df7
1 changed files with 8 additions and 7 deletions

View File

@ -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
# --------------------------------------------------------------------------- #