commit
960f42b70c
|
@ -1,10 +1,13 @@
|
||||||
#!/usr/bin/python3
|
#!/usr/bin/python3
|
||||||
import tkinter as tk
|
import Tkinter as tk
|
||||||
from tkinter import filedialog
|
# import tkinter as tk
|
||||||
from tkinter.colorchooser import askcolor
|
import tkFileDialog
|
||||||
from tkinter import ttk
|
import ttk
|
||||||
import tkinter.scrolledtext as tkst
|
import tkColorChooser
|
||||||
import tkinter.font
|
import tkFont
|
||||||
|
# from Tkinter import ttk
|
||||||
|
# import Tkinter.scrolledtext as tkst
|
||||||
|
# import Tkinter.font
|
||||||
import datetime
|
import datetime
|
||||||
import sys
|
import sys
|
||||||
import textwrap
|
import textwrap
|
||||||
|
@ -1052,30 +1055,30 @@ class Button(Element):
|
||||||
except: pass
|
except: pass
|
||||||
filetypes = [] if self.FileTypes is None else self.FileTypes
|
filetypes = [] if self.FileTypes is None else self.FileTypes
|
||||||
if self.BType == BUTTON_TYPE_BROWSE_FOLDER:
|
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 != '':
|
if folder_name != '':
|
||||||
try:
|
try:
|
||||||
strvar.set(folder_name)
|
strvar.set(folder_name)
|
||||||
self.TKStringVar.set(folder_name)
|
self.TKStringVar.set(folder_name)
|
||||||
except: pass
|
except: pass
|
||||||
elif self.BType == BUTTON_TYPE_BROWSE_FILE:
|
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 != '':
|
if file_name != '':
|
||||||
strvar.set(file_name)
|
strvar.set(file_name)
|
||||||
self.TKStringVar.set(file_name)
|
self.TKStringVar.set(file_name)
|
||||||
elif self.BType == BUTTON_TYPE_COLOR_CHOOSER:
|
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
|
color = color[1] # save only the #RRGGBB portion
|
||||||
strvar.set(color)
|
strvar.set(color)
|
||||||
self.TKStringVar.set(color)
|
self.TKStringVar.set(color)
|
||||||
elif self.BType == BUTTON_TYPE_BROWSE_FILES:
|
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 != '':
|
if file_name != '':
|
||||||
file_name = ';'.join(file_name)
|
file_name = ';'.join(file_name)
|
||||||
strvar.set(file_name)
|
strvar.set(file_name)
|
||||||
self.TKStringVar.set(file_name)
|
self.TKStringVar.set(file_name)
|
||||||
elif self.BType == BUTTON_TYPE_SAVEAS_FILE:
|
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 != '':
|
if file_name != '':
|
||||||
strvar.set(file_name)
|
strvar.set(file_name)
|
||||||
self.TKStringVar.set(file_name)
|
self.TKStringVar.set(file_name)
|
||||||
|
@ -2704,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 PackFormIntoFrame(form, containing_frame, toplevel_form):
|
||||||
def CharWidthInPixels():
|
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
|
# only set title on non-tabbed forms
|
||||||
border_depth = toplevel_form.BorderDepth if toplevel_form.BorderDepth is not None else DEFAULT_BORDER_WIDTH
|
border_depth = toplevel_form.BorderDepth if toplevel_form.BorderDepth is not None else DEFAULT_BORDER_WIDTH
|
||||||
# --------------------------------------------------------------------------- #
|
# --------------------------------------------------------------------------- #
|
||||||
|
|
Loading…
Reference in New Issue