Merge pull request #141 from MikeTheWatchGuy/Dev-latest
Fixed import as g instead of sg bug, made some demos borderless, used…
This commit is contained in:
commit
aed3b5a476
|
@ -1,29 +1,27 @@
|
||||||
|
|
||||||
def TightLayout():
|
import PySimpleGUI as sg
|
||||||
"""
|
"""
|
||||||
Turn off padding in order to get a really tight looking layout.
|
Turn off padding in order to get a really tight looking layout.
|
||||||
"""
|
"""
|
||||||
import PySimpleGUI as sg
|
sg.ChangeLookAndFeel('Dark')
|
||||||
sg.ChangeLookAndFeel('Dark')
|
sg.SetOptions(element_padding=(0, 0))
|
||||||
sg.SetOptions(element_padding=(0, 0))
|
layout = [[sg.T('User:', pad=((3, 0), 0)), sg.OptionMenu(values=('User 1', 'User 2'), size=(20, 1)),
|
||||||
layout = [[sg.T('User:', pad=((3, 0), 0)), sg.OptionMenu(values=('User 1', 'User 2'), size=(20, 1)),
|
sg.T('0', size=(8, 1))],
|
||||||
sg.T('0', size=(8, 1))],
|
[sg.T('Customer:', pad=((3, 0), 0)), sg.OptionMenu(values=('Customer 1', 'Customer 2'), size=(20, 1)),
|
||||||
[sg.T('Customer:', pad=((3, 0), 0)), sg.OptionMenu(values=('Customer 1', 'Customer 2'), size=(20, 1)),
|
sg.T('1', size=(8, 1))],
|
||||||
sg.T('1', size=(8, 1))],
|
[sg.T('Notes:', pad=((3, 0), 0)), sg.In(size=(44, 1), background_color='white', text_color='black')],
|
||||||
[sg.T('Notes:', pad=((3, 0), 0)), sg.In(size=(44, 1), background_color='white', text_color='black')],
|
[sg.ReadFormButton('Start', button_color=('white', 'black')),
|
||||||
[sg.ReadFormButton('Start', button_color=('white', 'black')),
|
sg.ReadFormButton('Stop', button_color=('gray50', 'black')),
|
||||||
sg.ReadFormButton('Stop', button_color=('gray50', 'black')),
|
sg.ReadFormButton('Reset', button_color=('white', '#9B0023')),
|
||||||
sg.ReadFormButton('Reset', button_color=('white', '#9B0023')),
|
sg.ReadFormButton('Submit', button_color=('gray60', 'springgreen4')),
|
||||||
sg.ReadFormButton('Submit', button_color=('gray60', 'springgreen4')),
|
sg.SimpleButton('Exit', button_color=('white', '#00406B'))]]
|
||||||
sg.SimpleButton('Exit', button_color=('white', '#00406B'))]]
|
form = sg.FlexForm("Time Tracker", default_element_size=(12, 1), text_justification='r', auto_size_text=False,
|
||||||
form = sg.FlexForm("Time Tracker", default_element_size=(12, 1), text_justification='r', auto_size_text=False,
|
auto_size_buttons=False, no_titlebar=True,
|
||||||
auto_size_buttons=False, no_titlebar=True,
|
default_button_element_size=(12, 1))
|
||||||
default_button_element_size=(12, 1))
|
form.Layout(layout)
|
||||||
form.Layout(layout)
|
while True:
|
||||||
while True:
|
button, values = form.Read()
|
||||||
button, values = form.Read()
|
if button is None or button == 'Exit':
|
||||||
if button is None or button == 'Exit':
|
break
|
||||||
return
|
|
||||||
|
|
||||||
|
|
||||||
TightLayout()
|
|
16
Demo_Chat.py
16
Demo_Chat.py
|
@ -16,13 +16,11 @@ def ChatBotWithHistory():
|
||||||
|
|
||||||
form = sg.FlexForm('Chat window with history', default_element_size=(30, 2), font=('Helvetica',' 13'), default_button_element_size=(8,2), return_keyboard_events=True)
|
form = sg.FlexForm('Chat window with history', default_element_size=(30, 2), font=('Helvetica',' 13'), default_button_element_size=(8,2), return_keyboard_events=True)
|
||||||
|
|
||||||
multiline_elem = sg.Multiline(size=(85, 5), enter_submits=True, key='query', do_not_clear=False)
|
|
||||||
history_elem = sg.T('', size=(20,3))
|
|
||||||
layout = [
|
layout = [
|
||||||
[sg.Text('Your output will go here', size=(40, 1))],
|
[sg.Text('Your output will go here', size=(40, 1))],
|
||||||
[sg.Output(size=(127, 30), font=('Helvetica 10'))],
|
[sg.Output(size=(127, 30), font=('Helvetica 10'))],
|
||||||
[sg.T('Command History'), history_elem],
|
[sg.T('Command History'), sg.T('', size=(20,3), key='history')],
|
||||||
[multiline_elem,
|
[sg.Multiline(size=(85, 5), enter_submits=True, key='query', do_not_clear=False),
|
||||||
sg.ReadFormButton('SEND', button_color=(sg.YELLOWS[0], sg.BLUES[0]), bind_return_key=True),
|
sg.ReadFormButton('SEND', button_color=(sg.YELLOWS[0], sg.BLUES[0]), bind_return_key=True),
|
||||||
sg.SimpleButton('EXIT', button_color=(sg.YELLOWS[0], sg.GREENS[0]))]
|
sg.SimpleButton('EXIT', button_color=(sg.YELLOWS[0], sg.GREENS[0]))]
|
||||||
]
|
]
|
||||||
|
@ -39,20 +37,20 @@ def ChatBotWithHistory():
|
||||||
print('The command you entered was {}'.format(query))
|
print('The command you entered was {}'.format(query))
|
||||||
command_history.append(query)
|
command_history.append(query)
|
||||||
history_offset = len(command_history)-1
|
history_offset = len(command_history)-1
|
||||||
multiline_elem.Update('') # manually clear input because keyboard events blocks clear
|
form.FindElement('query').Update('') # manually clear input because keyboard events blocks clear
|
||||||
history_elem.Update('\n'.join(command_history[-3:]))
|
form.FindElement('history').Update('\n'.join(command_history[-3:]))
|
||||||
elif button is None or button is 'EXIT': # quit if exit button or X
|
elif button is None or button is 'EXIT': # quit if exit button or X
|
||||||
break
|
break
|
||||||
elif 'Up' in button and len(command_history):
|
elif 'Up' in button and len(command_history):
|
||||||
command = command_history[history_offset]
|
command = command_history[history_offset]
|
||||||
history_offset -= 1 * (history_offset > 0) # decrement is not zero
|
history_offset -= 1 * (history_offset > 0) # decrement is not zero
|
||||||
multiline_elem.Update(command)
|
form.FindElement('query').Update(command)
|
||||||
elif 'Down' in button and len(command_history):
|
elif 'Down' in button and len(command_history):
|
||||||
history_offset += 1 * (history_offset < len(command_history)-1) # increment up to end of list
|
history_offset += 1 * (history_offset < len(command_history)-1) # increment up to end of list
|
||||||
command = command_history[history_offset]
|
command = command_history[history_offset]
|
||||||
multiline_elem.Update(command)
|
form.FindElement('query').Update(command)
|
||||||
elif 'Escape' in button:
|
elif 'Escape' in button:
|
||||||
multiline_elem.Update('')
|
form.FindElement('query').Update('')
|
||||||
|
|
||||||
exit(69)
|
exit(69)
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import PySimpleGUI as g
|
import PySimpleGUI as sg
|
||||||
from chatterbot import ChatBot
|
from chatterbot import ChatBot
|
||||||
import chatterbot.utils
|
import chatterbot.utils
|
||||||
|
|
||||||
|
@ -11,17 +11,17 @@ to collect user input that is sent to the chatbot. The reply is displayed in th
|
||||||
|
|
||||||
# Create the 'Trainer GUI'
|
# Create the 'Trainer GUI'
|
||||||
# The Trainer GUI consists of a lot of progress bars stacked on top of each other
|
# The Trainer GUI consists of a lot of progress bars stacked on top of each other
|
||||||
g.ChangeLookAndFeel('GreenTan')
|
sg.ChangeLookAndFeel('GreenTan')
|
||||||
MAX_PROG_BARS = 20 # number of training sessions
|
MAX_PROG_BARS = 20 # number of training sessions
|
||||||
bars = []
|
bars = []
|
||||||
texts = []
|
texts = []
|
||||||
training_layout = [[g.T('TRAINING PROGRESS', size=(20,1), font=('Helvetica', 17))],]
|
training_layout = [[sg.T('TRAINING PROGRESS', size=(20, 1), font=('Helvetica', 17))], ]
|
||||||
for i in range(MAX_PROG_BARS):
|
for i in range(MAX_PROG_BARS):
|
||||||
bars.append(g.ProgressBar(100, size=(30, 4)))
|
bars.append(sg.ProgressBar(100, size=(30, 4)))
|
||||||
texts.append(g.T(' '*20, size=(20,1), justification='right'))
|
texts.append(sg.T(' ' * 20, size=(20, 1), justification='right'))
|
||||||
training_layout += [[texts[i], bars[i]],] # add a single row
|
training_layout += [[texts[i], bars[i]],] # add a single row
|
||||||
|
|
||||||
training_form = g.FlexForm('Training')
|
training_form = sg.FlexForm('Training')
|
||||||
training_form.Layout(training_layout)
|
training_form.Layout(training_layout)
|
||||||
current_bar = 0
|
current_bar = 0
|
||||||
|
|
||||||
|
@ -50,10 +50,10 @@ chatbot = ChatBot('Ron Obvious', trainer='chatterbot.trainers.ChatterBotCorpusTr
|
||||||
chatbot.train("chatterbot.corpus.english")
|
chatbot.train("chatterbot.corpus.english")
|
||||||
|
|
||||||
################# GUI #################
|
################# GUI #################
|
||||||
with g.FlexForm('Chat Window', auto_size_text=True, default_element_size=(30, 2)) as form:
|
with sg.FlexForm('Chat Window', auto_size_text=True, default_element_size=(30, 2)) as form:
|
||||||
layout = [[g.Output(size=(80, 20))],
|
layout = [[sg.Output(size=(80, 20))],
|
||||||
[g.Multiline(size=(70, 5), enter_submits=True),
|
[sg.Multiline(size=(70, 5), enter_submits=True),
|
||||||
g.ReadFormButton('SEND', bind_return_key=True), g.ReadFormButton('EXIT')]]
|
sg.ReadFormButton('SEND', bind_return_key=True), sg.ReadFormButton('EXIT')]]
|
||||||
|
|
||||||
form.Layout(layout)
|
form.Layout(layout)
|
||||||
# ---===--- Loop taking in user input and using it to query HowDoI web oracle --- #
|
# ---===--- Loop taking in user input and using it to query HowDoI web oracle --- #
|
||||||
|
@ -62,7 +62,7 @@ with g.FlexForm('Chat Window', auto_size_text=True, default_element_size=(30, 2)
|
||||||
if button is not 'SEND':
|
if button is not 'SEND':
|
||||||
break
|
break
|
||||||
string = value.rstrip()
|
string = value.rstrip()
|
||||||
print(string.rjust(120))
|
print(' '+string)
|
||||||
# send the user input to chatbot to get a response
|
# send the user input to chatbot to get a response
|
||||||
response = chatbot.get_response(value.rstrip())
|
response = chatbot.get_response(value.rstrip())
|
||||||
print(response)
|
print(response)
|
|
@ -1,4 +1,4 @@
|
||||||
import PySimpleGUI as g
|
import PySimpleGUI as sg
|
||||||
|
|
||||||
MY_WINDOW_ICON = 'E:\\TheRealMyDocs\\Icons\\The Planets\\jupiter.ico'
|
MY_WINDOW_ICON = 'E:\\TheRealMyDocs\\Icons\\The Planets\\jupiter.ico'
|
||||||
reverse = {}
|
reverse = {}
|
||||||
|
@ -1639,13 +1639,13 @@ def show_all_colors_on_buttons():
|
||||||
global reverse
|
global reverse
|
||||||
global colorhex
|
global colorhex
|
||||||
global colors
|
global colors
|
||||||
form = g.FlexForm('Colors on Buttons Demo', default_element_size=(3,1), location=(0,0), icon=MY_WINDOW_ICON, font=("Helvetica", 7))
|
form = sg.FlexForm('Colors on Buttons Demo', default_element_size=(3, 1), location=(0, 0), icon=MY_WINDOW_ICON, font=("Helvetica", 7))
|
||||||
row = []
|
row = []
|
||||||
row_len = 20
|
row_len = 20
|
||||||
for i, c in enumerate(colors):
|
for i, c in enumerate(colors):
|
||||||
hex = get_hex_from_name(c)
|
hex = get_hex_from_name(c)
|
||||||
button1 = g.Button(button_text=c, button_color=(get_complementary_hex(hex), hex), size=(8,1))
|
button1 = sg.Button(button_text=c, button_color=(get_complementary_hex(hex), hex), size=(8, 1))
|
||||||
button2 = g.Button(button_text=c, button_color=(hex,get_complementary_hex(hex)), size=(8,1))
|
button2 = sg.Button(button_text=c, button_color=(hex, get_complementary_hex(hex)), size=(8, 1))
|
||||||
row.append(button1)
|
row.append(button1)
|
||||||
row.append(button2)
|
row.append(button2)
|
||||||
if (i+1) % row_len == 0:
|
if (i+1) % row_len == 0:
|
||||||
|
@ -1656,12 +1656,12 @@ def show_all_colors_on_buttons():
|
||||||
form.Show()
|
form.Show()
|
||||||
|
|
||||||
|
|
||||||
GoodColors = [('#0e6251',g.RGB(255,246,122) ),
|
GoodColors = [('#0e6251', sg.RGB(255, 246, 122)),
|
||||||
('white', g.RGB(0,74,60)),
|
('white', sg.RGB(0, 74, 60)),
|
||||||
(g.RGB(0,210,124),g.RGB(0,74,60) ),
|
(sg.RGB(0, 210, 124), sg.RGB(0, 74, 60)),
|
||||||
(g.RGB(0,210,87),g.RGB(0,74,60) ),
|
(sg.RGB(0, 210, 87), sg.RGB(0, 74, 60)),
|
||||||
(g.RGB(0,164,73),g.RGB(0,74,60) ),
|
(sg.RGB(0, 164, 73), sg.RGB(0, 74, 60)),
|
||||||
(g.RGB(0,74,60),g.RGB(0,74,60) ),
|
(sg.RGB(0, 74, 60), sg.RGB(0, 74, 60)),
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -1676,15 +1676,15 @@ def main():
|
||||||
# show_all_colors_on_buttons()
|
# show_all_colors_on_buttons()
|
||||||
while True:
|
while True:
|
||||||
# ------- Form show ------- #
|
# ------- Form show ------- #
|
||||||
layout = [[g.Text('Find color')],
|
layout = [[sg.Text('Find color')],
|
||||||
[g.Text('Demonstration of colors')],
|
[sg.Text('Demonstration of colors')],
|
||||||
[g.Text('Enter a color name in text or hex #RRGGBB format')],
|
[sg.Text('Enter a color name in text or hex #RRGGBB format')],
|
||||||
[g.InputText()],
|
[sg.InputText()],
|
||||||
[g.Listbox(list_of_colors, size=(20,30)), g.T('Or choose from list')],
|
[sg.Listbox(list_of_colors, size=(20, 30)), sg.T('Or choose from list')],
|
||||||
[g.Submit(), g.Quit(), g.SimpleButton('Show me lots of colors!', button_color=('white','#0e6251'))],
|
[sg.Submit(), sg.Quit(), sg.SimpleButton('Show me lots of colors!', button_color=('white', '#0e6251'))],
|
||||||
]
|
]
|
||||||
# [g.Multiline(DefaultText=str(printable), Size=(30,20))]]
|
# [g.Multiline(DefaultText=str(printable), Size=(30,20))]]
|
||||||
(button, (hex_input, drop_down_value)) = g.FlexForm('Color Demo', auto_size_text=True, icon=MY_WINDOW_ICON).LayoutAndRead(layout)
|
(button, (hex_input, drop_down_value)) = sg.FlexForm('Color Demo', auto_size_text=True, icon=MY_WINDOW_ICON).LayoutAndRead(layout)
|
||||||
|
|
||||||
# ------- OUTPUT results portion ------- #
|
# ------- OUTPUT results portion ------- #
|
||||||
if button == '' or button == 'Quit' or button is None:
|
if button == '' or button == 'Quit' or button is None:
|
||||||
|
@ -1705,11 +1705,11 @@ def main():
|
||||||
complementary_color = get_name_from_hex(complementary_hex)
|
complementary_color = get_name_from_hex(complementary_hex)
|
||||||
|
|
||||||
# g.MsgBox('Colors', 'The RBG value is', rgb, 'color and comp are', color_string, compl)
|
# g.MsgBox('Colors', 'The RBG value is', rgb, 'color and comp are', color_string, compl)
|
||||||
layout = [[g.Text('That color and it\'s compliment are shown on these buttons. This form auto-closes')],
|
layout = [[sg.Text('That color and it\'s compliment are shown on these buttons. This form auto-closes')],
|
||||||
[g.Button(button_text=color_name, button_color=(color_hex, complementary_hex))],
|
[sg.Button(button_text=color_name, button_color=(color_hex, complementary_hex))],
|
||||||
[g.Button(button_text=complementary_hex + ' ' + complementary_color, button_color=(complementary_hex , color_hex), size=(30,1))],
|
[sg.Button(button_text=complementary_hex + ' ' + complementary_color, button_color=(complementary_hex , color_hex), size=(30, 1))],
|
||||||
]
|
]
|
||||||
g.FlexForm('Color demo', default_element_size=(100,1), auto_size_text=True, auto_close=True, auto_close_duration=5, icon=MY_WINDOW_ICON).LayoutAndRead(layout)
|
sg.FlexForm('Color demo', default_element_size=(100, 1), auto_size_text=True, auto_close=True, auto_close_duration=5, icon=MY_WINDOW_ICON).LayoutAndRead(layout)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -37,14 +37,14 @@ from PIL import Image, ImageTk
|
||||||
import time
|
import time
|
||||||
|
|
||||||
if len(sys.argv) == 1:
|
if len(sys.argv) == 1:
|
||||||
rc, fname = sg.GetFileBox('Document Browser', 'Document file to open',
|
fname = sg.PopupGetFile('Document Browser', 'Document file to open', no_window=True,
|
||||||
file_types = (
|
file_types = (
|
||||||
("PDF Files", "*.pdf"),
|
("PDF Files", "*.pdf"),
|
||||||
("XPS Files", "*.*xps"),
|
("XPS Files", "*.*xps"),
|
||||||
("Epub Files", "*.epub"),
|
("Epub Files", "*.epub"),
|
||||||
("Fiction Books", "*.fb2"),
|
("Fiction Books", "*.fb2"),
|
||||||
("Comic Books", "*.cbz"),
|
("Comic Books", "*.cbz"),
|
||||||
("HTML", "*.htm*"),
|
("HTML", "*.htm*")
|
||||||
# add more document types here
|
# add more document types here
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -122,7 +122,7 @@ root.destroy()
|
||||||
del root
|
del root
|
||||||
|
|
||||||
form = sg.FlexForm(title, return_keyboard_events = True,
|
form = sg.FlexForm(title, return_keyboard_events = True,
|
||||||
location = (0,0), use_default_focus = False)
|
location = (0,0), use_default_focus = False, no_titlebar=True)
|
||||||
|
|
||||||
cur_page = 0
|
cur_page = 0
|
||||||
data, clip_pos = get_page(cur_page,
|
data, clip_pos = get_page(cur_page,
|
||||||
|
|
|
@ -30,15 +30,12 @@ def HowDoI():
|
||||||
# ------- Make a new FlexForm ------- #
|
# ------- Make a new FlexForm ------- #
|
||||||
sg.ChangeLookAndFeel('GreenTan') # give our form a spiffy set of colors
|
sg.ChangeLookAndFeel('GreenTan') # give our form a spiffy set of colors
|
||||||
|
|
||||||
|
|
||||||
multiline_elem = sg.Multiline(size=(85, 5), enter_submits=True, key='query', do_not_clear=False)
|
|
||||||
history_elem = sg.T('', size=(40,3), text_color=sg.BLUES[0])
|
|
||||||
layout = [
|
layout = [
|
||||||
[sg.Text('Ask and your answer will appear here....', size=(40, 1))],
|
[sg.Text('Ask and your answer will appear here....', size=(40, 1))],
|
||||||
[sg.Output(size=(127, 30), font=('Helvetica 10'))],
|
[sg.Output(size=(127, 30), font=('Helvetica 10'))],
|
||||||
[ sg.Spin(values=(1, 2, 3, 4), initial_value=1, size=(2, 1), key='Num Answers', font='Helvetica 15'), sg.T('Num Answers',font='Helvetica 15'), sg.Checkbox('Display Full Text', key='full text', font='Helvetica 15'),
|
[ sg.Spin(values=(1, 2, 3, 4), initial_value=1, size=(2, 1), key='Num Answers', font='Helvetica 15'), sg.T('Num Answers',font='Helvetica 15'), sg.Checkbox('Display Full Text', key='full text', font='Helvetica 15'),
|
||||||
sg.T('Command History'), history_elem],
|
sg.T('Command History'), sg.T('', size=(40,3), text_color=sg.BLUES[0], key='history')],
|
||||||
[multiline_elem,
|
[sg.Multiline(size=(85, 5), enter_submits=True, key='query', do_not_clear=False),
|
||||||
sg.ReadFormButton('SEND', button_color=(sg.YELLOWS[0], sg.BLUES[0]), bind_return_key=True),
|
sg.ReadFormButton('SEND', button_color=(sg.YELLOWS[0], sg.BLUES[0]), bind_return_key=True),
|
||||||
sg.SimpleButton('EXIT', button_color=(sg.YELLOWS[0], sg.GREENS[0]))]
|
sg.SimpleButton('EXIT', button_color=(sg.YELLOWS[0], sg.GREENS[0]))]
|
||||||
]
|
]
|
||||||
|
@ -56,20 +53,20 @@ def HowDoI():
|
||||||
QueryHowDoI(query, value['Num Answers'], value['full text']) # send the string to HowDoI
|
QueryHowDoI(query, value['Num Answers'], value['full text']) # send the string to HowDoI
|
||||||
command_history.append(query)
|
command_history.append(query)
|
||||||
history_offset = len(command_history)-1
|
history_offset = len(command_history)-1
|
||||||
multiline_elem.Update('') # manually clear input because keyboard events blocks clear
|
form.FindElement('query').Update('') # manually clear input because keyboard events blocks clear
|
||||||
history_elem.Update('\n'.join(command_history[-3:]))
|
form.FindElement('history').Update('\n'.join(command_history[-3:]))
|
||||||
elif button is None or button is 'EXIT': # if exit button or closed using X
|
elif button is None or button is 'EXIT': # if exit button or closed using X
|
||||||
break
|
break
|
||||||
elif 'Up' in button and len(command_history): # scroll back in history
|
elif 'Up' in button and len(command_history): # scroll back in history
|
||||||
command = command_history[history_offset]
|
command = command_history[history_offset]
|
||||||
history_offset -= 1 * (history_offset > 0) # decrement is not zero
|
history_offset -= 1 * (history_offset > 0) # decrement is not zero
|
||||||
multiline_elem.Update(command)
|
form.FindElement('query').Update(command)
|
||||||
elif 'Down' in button and len(command_history): # scroll forward in history
|
elif 'Down' in button and len(command_history): # scroll forward in history
|
||||||
history_offset += 1 * (history_offset < len(command_history)-1) # increment up to end of list
|
history_offset += 1 * (history_offset < len(command_history)-1) # increment up to end of list
|
||||||
command = command_history[history_offset]
|
command = command_history[history_offset]
|
||||||
multiline_elem.Update(command)
|
form.FindElement('query').Update(command)
|
||||||
elif 'Escape' in button: # clear currently line
|
elif 'Escape' in button: # clear currently line
|
||||||
multiline_elem.Update('')
|
form.FindElement('query').Update('')
|
||||||
|
|
||||||
exit(69)
|
exit(69)
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import PySimpleGUI as g
|
import PySimpleGUI as sg
|
||||||
|
|
||||||
# g.SetOptions(button_color=g.COLOR_SYSTEM_DEFAULT) # because some people like gray buttons
|
# g.SetOptions(button_color=g.COLOR_SYSTEM_DEFAULT) # because some people like gray buttons
|
||||||
|
|
||||||
|
@ -12,19 +12,17 @@ import PySimpleGUI as g
|
||||||
|
|
||||||
|
|
||||||
# create the 2 Elements we want to control outside the form
|
# create the 2 Elements we want to control outside the form
|
||||||
out_elem = g.Text('', size=(15, 1), font=('Helvetica', 18), text_color='red')
|
|
||||||
in_elem = g.Input(size=(10, 1), do_not_clear=True, key='input')
|
|
||||||
|
|
||||||
layout = [[g.Text('Enter Your Passcode')],
|
layout = [[sg.Text('Enter Your Passcode')],
|
||||||
[in_elem],
|
[sg.Input(size=(10, 1), do_not_clear=True, key='input')],
|
||||||
[g.ReadFormButton('1'), g.ReadFormButton('2'), g.ReadFormButton('3')],
|
[sg.ReadFormButton('1'), sg.ReadFormButton('2'), sg.ReadFormButton('3')],
|
||||||
[g.ReadFormButton('4'), g.ReadFormButton('5'), g.ReadFormButton('6')],
|
[sg.ReadFormButton('4'), sg.ReadFormButton('5'), sg.ReadFormButton('6')],
|
||||||
[g.ReadFormButton('7'), g.ReadFormButton('8'), g.ReadFormButton('9')],
|
[sg.ReadFormButton('7'), sg.ReadFormButton('8'), sg.ReadFormButton('9')],
|
||||||
[g.ReadFormButton('Submit'), g.ReadFormButton('0'), g.ReadFormButton('Clear')],
|
[sg.ReadFormButton('Submit'), sg.ReadFormButton('0'), sg.ReadFormButton('Clear')],
|
||||||
[out_elem],
|
[sg.Text('', size=(15, 1), font=('Helvetica', 18), text_color='red', key='out')],
|
||||||
]
|
]
|
||||||
|
|
||||||
form = g.FlexForm('Keypad', default_button_element_size=(5, 2), auto_size_buttons=False)
|
form = sg.FlexForm('Keypad', default_button_element_size=(5, 2), auto_size_buttons=False)
|
||||||
form.Layout(layout)
|
form.Layout(layout)
|
||||||
|
|
||||||
# Loop forever reading the form's values, updating the Input field
|
# Loop forever reading the form's values, updating the Input field
|
||||||
|
@ -40,6 +38,6 @@ while True:
|
||||||
keys_entered += button # add the new digit
|
keys_entered += button # add the new digit
|
||||||
elif button is 'Submit':
|
elif button is 'Submit':
|
||||||
keys_entered = values['input']
|
keys_entered = values['input']
|
||||||
out_elem.Update(keys_entered) # output the final string
|
form.FindElement('out').Update(keys_entered) # output the final string
|
||||||
|
|
||||||
in_elem.Update(keys_entered) # change the form to reflect current key string
|
form.FindElement('input').Update(keys_entered) # change the form to reflect current key string
|
|
@ -1,4 +1,4 @@
|
||||||
import PySimpleGUI as g
|
import PySimpleGUI as sg
|
||||||
import matplotlib
|
import matplotlib
|
||||||
matplotlib.use('TkAgg')
|
matplotlib.use('TkAgg')
|
||||||
from matplotlib.backends.backend_tkagg import FigureCanvasAgg
|
from matplotlib.backends.backend_tkagg import FigureCanvasAgg
|
||||||
|
@ -107,14 +107,14 @@ fig = plt.gcf() # if using Pyplot then get the figure from the plot
|
||||||
# information to display. #
|
# information to display. #
|
||||||
# --------------------------------------------------------------------------------#
|
# --------------------------------------------------------------------------------#
|
||||||
figure_x, figure_y, figure_w, figure_h = fig.bbox.bounds
|
figure_x, figure_y, figure_w, figure_h = fig.bbox.bounds
|
||||||
canvas_elem = g.Canvas(size=(figure_w, figure_h)) # get the canvas we'll be drawing on
|
canvas_elem = sg.Canvas(size=(figure_w, figure_h)) # get the canvas we'll be drawing on
|
||||||
# define the form layout
|
# define the form layout
|
||||||
layout = [[g.Text('Plot test')],
|
layout = [[sg.Text('Plot test')],
|
||||||
[canvas_elem],
|
[canvas_elem],
|
||||||
[g.OK(pad=((figure_w/2,0), 3), size=(4,2))]]
|
[sg.OK(pad=((figure_w / 2, 0), 3), size=(4, 2))]]
|
||||||
|
|
||||||
# create the form and show it without the plot
|
# create the form and show it without the plot
|
||||||
form = g.FlexForm('Demo Application - Embedding Matplotlib In PySimpleGUI')
|
form = sg.FlexForm('Demo Application - Embedding Matplotlib In PySimpleGUI')
|
||||||
form.Layout(layout)
|
form.Layout(layout)
|
||||||
form.ReadNonBlocking()
|
form.ReadNonBlocking()
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
from random import randint
|
from random import randint
|
||||||
import PySimpleGUI as g
|
import PySimpleGUI as sg
|
||||||
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, FigureCanvasAgg
|
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, FigureCanvasAgg
|
||||||
from matplotlib.figure import Figure
|
from matplotlib.figure import Figure
|
||||||
import matplotlib.backends.tkagg as tkagg
|
import matplotlib.backends.tkagg as tkagg
|
||||||
|
@ -14,16 +14,16 @@ def main():
|
||||||
ax.set_ylabel("Y axis")
|
ax.set_ylabel("Y axis")
|
||||||
ax.grid()
|
ax.grid()
|
||||||
|
|
||||||
canvas_elem = g.Canvas(size=(640, 480)) # get the canvas we'll be drawing on
|
canvas_elem = sg.Canvas(size=(640, 480)) # get the canvas we'll be drawing on
|
||||||
slider_elem = g.Slider(range=(0,10000), size=(60,10), orientation='h')
|
slider_elem = sg.Slider(range=(0, 10000), size=(60, 10), orientation='h')
|
||||||
# define the form layout
|
# define the form layout
|
||||||
layout = [[g.Text('Animated Matplotlib', size=(40,1), justification='center', font='Helvetica 20')],
|
layout = [[sg.Text('Animated Matplotlib', size=(40, 1), justification='center', font='Helvetica 20')],
|
||||||
[canvas_elem],
|
[canvas_elem],
|
||||||
[slider_elem],
|
[slider_elem],
|
||||||
[g.ReadFormButton('Exit', size=(10,2), pad=((280, 0), 3), font='Helvetica 14')]]
|
[sg.ReadFormButton('Exit', size=(10, 2), pad=((280, 0), 3), font='Helvetica 14')]]
|
||||||
|
|
||||||
# create the form and show it without the plot
|
# create the form and show it without the plot
|
||||||
form = g.FlexForm('Demo Application - Embedding Matplotlib In PySimpleGUI')
|
form = sg.FlexForm('Demo Application - Embedding Matplotlib In PySimpleGUI')
|
||||||
form.Layout(layout)
|
form.Layout(layout)
|
||||||
form.ReadNonBlocking()
|
form.ReadNonBlocking()
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
from random import randint
|
from random import randint
|
||||||
import PySimpleGUI as g
|
import PySimpleGUI as sg
|
||||||
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, FigureCanvasAgg
|
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, FigureCanvasAgg
|
||||||
from matplotlib.figure import Figure
|
from matplotlib.figure import Figure
|
||||||
import matplotlib.backends.tkagg as tkagg
|
import matplotlib.backends.tkagg as tkagg
|
||||||
|
@ -7,14 +7,14 @@ import tkinter as tk
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
canvas_elem = g.Canvas(size=(640, 480)) # get the canvas we'll be drawing on
|
canvas_elem = sg.Canvas(size=(640, 480)) # get the canvas we'll be drawing on
|
||||||
# define the form layout
|
# define the form layout
|
||||||
layout = [[g.Text('Animated Matplotlib', size=(40,1), justification='center', font='Helvetica 20')],
|
layout = [[sg.Text('Animated Matplotlib', size=(40, 1), justification='center', font='Helvetica 20')],
|
||||||
[canvas_elem],
|
[canvas_elem],
|
||||||
[g.ReadFormButton('Exit', size=(10,2), pad=((280, 0), 3), font='Helvetica 14')]]
|
[sg.ReadFormButton('Exit', size=(10, 2), pad=((280, 0), 3), font='Helvetica 14')]]
|
||||||
|
|
||||||
# create the form and show it without the plot
|
# create the form and show it without the plot
|
||||||
form = g.FlexForm('Demo Application - Embedding Matplotlib In PySimpleGUI')
|
form = sg.FlexForm('Demo Application - Embedding Matplotlib In PySimpleGUI')
|
||||||
form.Layout(layout)
|
form.Layout(layout)
|
||||||
form.ReadNonBlocking()
|
form.ReadNonBlocking()
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import PySimpleGUI as g
|
import PySimpleGUI as sg
|
||||||
import matplotlib
|
import matplotlib
|
||||||
matplotlib.use('TkAgg')
|
matplotlib.use('TkAgg')
|
||||||
from matplotlib.backends.backend_tkagg import FigureCanvasAgg
|
from matplotlib.backends.backend_tkagg import FigureCanvasAgg
|
||||||
|
@ -862,21 +862,21 @@ fig_dict = {'Pyplot Simple':PyplotSimple, 'Pyplot Formatstr':PyplotFormatstr,'Py
|
||||||
'Artist Customized Box Plots 2' : ArtistBoxplot2, 'Pyplot Histogram' : PyplotHistogram}
|
'Artist Customized Box Plots 2' : ArtistBoxplot2, 'Pyplot Histogram' : PyplotHistogram}
|
||||||
|
|
||||||
|
|
||||||
g.ChangeLookAndFeel('LightGreen')
|
sg.ChangeLookAndFeel('LightGreen')
|
||||||
figure_w, figure_h = 650, 650
|
figure_w, figure_h = 650, 650
|
||||||
canvas_elem = g.Canvas(size=(figure_w, figure_h)) # get the canvas we'll be drawing on
|
canvas_elem = sg.Canvas(size=(figure_w, figure_h)) # get the canvas we'll be drawing on
|
||||||
multiline_elem = g.Multiline(size=(70,35),pad=(5,(3,90)))
|
multiline_elem = sg.Multiline(size=(70, 35), pad=(5, (3, 90)))
|
||||||
# define the form layout
|
# define the form layout
|
||||||
listbox_values = [key for key in fig_dict.keys()]
|
listbox_values = [key for key in fig_dict.keys()]
|
||||||
col_listbox = [[g.Listbox(values=listbox_values, change_submits=True, size=(28, len(listbox_values)), key='func')],
|
col_listbox = [[sg.Listbox(values=listbox_values, change_submits=True, size=(28, len(listbox_values)), key='func')],
|
||||||
[g.T(' '*12), g.Exit(size=(5,2))]]
|
[sg.T(' ' * 12), sg.Exit(size=(5, 2))]]
|
||||||
|
|
||||||
layout = [[g.Text('Matplotlib Plot Test', font=('current 18'))],
|
layout = [[sg.Text('Matplotlib Plot Test', font=('current 18'))],
|
||||||
[g.Column(col_listbox, pad=(5,(3,330))), canvas_elem, multiline_elem],
|
[sg.Column(col_listbox, pad=(5, (3, 330))), canvas_elem, multiline_elem],
|
||||||
]
|
]
|
||||||
|
|
||||||
# create the form and show it without the plot
|
# create the form and show it without the plot
|
||||||
form = g.FlexForm('Demo Application - Embedding Matplotlib In PySimpleGUI')
|
form = sg.FlexForm('Demo Application - Embedding Matplotlib In PySimpleGUI')
|
||||||
form.Layout(layout)
|
form.Layout(layout)
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import PySimpleGUI as g
|
import PySimpleGUI as sg
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
from matplotlib.backends.backend_tkagg import FigureCanvasAgg
|
from matplotlib.backends.backend_tkagg import FigureCanvasAgg
|
||||||
import matplotlib.backends.tkagg as tkagg
|
import matplotlib.backends.tkagg as tkagg
|
||||||
|
@ -640,12 +640,12 @@ def draw(fig, canvas):
|
||||||
def main():
|
def main():
|
||||||
global g_my_globals
|
global g_my_globals
|
||||||
|
|
||||||
canvas_elem = g.Canvas(size=SIZE, background_color='white') # get the canvas we'll be drawing on
|
canvas_elem = sg.Canvas(size=SIZE, background_color='white') # get the canvas we'll be drawing on
|
||||||
# define the form layout
|
# define the form layout
|
||||||
layout = [[ canvas_elem, g.ReadFormButton('Exit', pad=(0,(210,0)))] ]
|
layout = [[canvas_elem, sg.ReadFormButton('Exit', pad=(0, (210, 0)))]]
|
||||||
|
|
||||||
# create the form and show it without the plot
|
# create the form and show it without the plot
|
||||||
form = g.FlexForm('Ping Graph', background_color='white')
|
form = sg.FlexForm('Ping Graph', background_color='white')
|
||||||
form.Layout(layout)
|
form.Layout(layout)
|
||||||
form.ReadNonBlocking()
|
form.ReadNonBlocking()
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import PySimpleGUI as g
|
import PySimpleGUI as sg
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
import ping
|
import ping
|
||||||
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, FigureCanvasAgg
|
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, FigureCanvasAgg
|
||||||
|
@ -74,14 +74,14 @@ def draw(fig, canvas):
|
||||||
def main():
|
def main():
|
||||||
global g_my_globals
|
global g_my_globals
|
||||||
|
|
||||||
canvas_elem = g.Canvas(size=(640, 480)) # get the canvas we'll be drawing on
|
canvas_elem = sg.Canvas(size=(640, 480)) # get the canvas we'll be drawing on
|
||||||
# define the form layout
|
# define the form layout
|
||||||
layout = [[g.Text('Animated Ping', size=(40,1), justification='center', font='Helvetica 20')],
|
layout = [[sg.Text('Animated Ping', size=(40, 1), justification='center', font='Helvetica 20')],
|
||||||
[canvas_elem],
|
[canvas_elem],
|
||||||
[g.ReadFormButton('Exit', size=(10,2), pad=((280, 0), 3), font='Helvetica 14')]]
|
[sg.ReadFormButton('Exit', size=(10, 2), pad=((280, 0), 3), font='Helvetica 14')]]
|
||||||
|
|
||||||
# create the form and show it without the plot
|
# create the form and show it without the plot
|
||||||
form = g.FlexForm('Demo Application - Embedding Matplotlib In PySimpleGUI')
|
form = sg.FlexForm('Demo Application - Embedding Matplotlib In PySimpleGUI')
|
||||||
form.Layout(layout)
|
form.Layout(layout)
|
||||||
form.ReadNonBlocking()
|
form.ReadNonBlocking()
|
||||||
|
|
||||||
|
|
|
@ -17,14 +17,13 @@ def MediaPlayerGUI():
|
||||||
image_exit = './ButtonGraphics/Exit.png'
|
image_exit = './ButtonGraphics/Exit.png'
|
||||||
|
|
||||||
# A text element that will be changed to display messages in the GUI
|
# A text element that will be changed to display messages in the GUI
|
||||||
TextElem = sg.Text('', size=(15, 2), font=("Helvetica", 14))
|
|
||||||
|
|
||||||
# Open a form, note that context manager can't be used generally speaking for async forms
|
# Open a form, note that context manager can't be used generally speaking for async forms
|
||||||
form = sg.FlexForm('Media File Player', auto_size_text=True, default_element_size=(20, 1),
|
form = sg.FlexForm('Media File Player', auto_size_text=True, default_element_size=(20, 1),
|
||||||
font=("Helvetica", 25))
|
font=("Helvetica", 25), no_titlebar=True)
|
||||||
# define layout of the rows
|
# define layout of the rows
|
||||||
layout= [[sg.Text('Media File Player',size=(17,1), font=("Helvetica", 25))],
|
layout= [[sg.Text('Media File Player',size=(17,1), font=("Helvetica", 25))],
|
||||||
[TextElem],
|
[sg.Text('', size=(15, 2), font=("Helvetica", 14), key='output')],
|
||||||
[sg.ReadFormButton('Restart Song', button_color=(background,background),
|
[sg.ReadFormButton('Restart Song', button_color=(background,background),
|
||||||
image_filename=image_restart, image_size=(50, 50), image_subsample=2, border_width=0),
|
image_filename=image_restart, image_size=(50, 50), image_subsample=2, border_width=0),
|
||||||
sg.Text(' ' * 2),
|
sg.Text(' ' * 2),
|
||||||
|
@ -60,7 +59,7 @@ def MediaPlayerGUI():
|
||||||
break
|
break
|
||||||
# If a button was pressed, display it on the GUI by updating the text element
|
# If a button was pressed, display it on the GUI by updating the text element
|
||||||
if button:
|
if button:
|
||||||
TextElem.Update(button)
|
form.FindElement('output').Update(button)
|
||||||
|
|
||||||
MediaPlayerGUI()
|
MediaPlayerGUI()
|
||||||
|
|
||||||
|
|
|
@ -8,10 +8,9 @@ def StatusOutputExample():
|
||||||
# Make a form, but don't use context manager
|
# Make a form, but don't use context manager
|
||||||
form = sg.FlexForm('Running Timer', auto_size_text=True)
|
form = sg.FlexForm('Running Timer', auto_size_text=True)
|
||||||
# Create a text element that will be updated with status information on the GUI itself
|
# Create a text element that will be updated with status information on the GUI itself
|
||||||
output_element = sg.Text('', size=(8, 2), font=('Helvetica', 20), justification='center')
|
|
||||||
# Create the rows
|
# Create the rows
|
||||||
form_rows = [[sg.Text('Non-blocking GUI with updates')],
|
form_rows = [[sg.Text('Non-blocking GUI with updates')],
|
||||||
[output_element],
|
[sg.Text('', size=(8, 2), font=('Helvetica', 20), justification='center', key='output')],
|
||||||
[sg.ReadFormButton('LED On'), sg.ReadFormButton('LED Off'), sg.ReadFormButton('Quit')]]
|
[sg.ReadFormButton('LED On'), sg.ReadFormButton('LED Off'), sg.ReadFormButton('Quit')]]
|
||||||
# Layout the rows of the form and perform a read. Indicate the form is non-blocking!
|
# Layout the rows of the form and perform a read. Indicate the form is non-blocking!
|
||||||
form.LayoutAndRead(form_rows, non_blocking=True)
|
form.LayoutAndRead(form_rows, non_blocking=True)
|
||||||
|
@ -25,7 +24,7 @@ def StatusOutputExample():
|
||||||
i=0
|
i=0
|
||||||
while (True):
|
while (True):
|
||||||
# This is the code that reads and updates your window
|
# This is the code that reads and updates your window
|
||||||
output_element.Update('{:02d}:{:02d}.{:02d}'.format((i // 100) // 60, (i // 100) % 60, i % 100))
|
form.FindElement('output').Update('{:02d}:{:02d}.{:02d}'.format((i // 100) // 60, (i // 100) % 60, i % 100))
|
||||||
button, values = form.ReadNonBlocking()
|
button, values = form.ReadNonBlocking()
|
||||||
if button == 'Quit' or values is None:
|
if button == 'Quit' or values is None:
|
||||||
break
|
break
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import PySimpleGUI as g
|
import PySimpleGUI as rg
|
||||||
|
|
||||||
# GUI for switching an LED on and off to GPIO14
|
# GUI for switching an LED on and off to GPIO14
|
||||||
|
|
||||||
|
@ -28,18 +28,18 @@ def FlashLED():
|
||||||
GPIO.output(14, GPIO.LOW)
|
GPIO.output(14, GPIO.LOW)
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
|
|
||||||
results_elem = g.T('', size=(30,1))
|
results_elem = rg.T('', size=(30, 1))
|
||||||
|
|
||||||
layout = [[g.T('Raspberry Pi LEDs')],
|
layout = [[rg.T('Raspberry Pi LEDs')],
|
||||||
[results_elem],
|
[results_elem],
|
||||||
[g.ReadFormButton('Switch LED')],
|
[rg.ReadFormButton('Switch LED')],
|
||||||
[g.ReadFormButton('Flash LED')],
|
[rg.ReadFormButton('Flash LED')],
|
||||||
[g.ReadFormButton('Show slider value')],
|
[rg.ReadFormButton('Show slider value')],
|
||||||
[g.Slider(range=(0, 100), default_value=0, orientation='h', size=(40,20), key='slider')],
|
[rg.Slider(range=(0, 100), default_value=0, orientation='h', size=(40, 20), key='slider')],
|
||||||
[g.Exit()]
|
[rg.Exit()]
|
||||||
]
|
]
|
||||||
|
|
||||||
form = g.FlexForm('Raspberry Pi GUI')
|
form = rg.FlexForm('Raspberry Pi GUI')
|
||||||
form.Layout(layout)
|
form.Layout(layout)
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
|
@ -56,4 +56,4 @@ while True:
|
||||||
elif button is 'Show slider value':
|
elif button is 'Show slider value':
|
||||||
results_elem.Update('Slider = %s'%values['slider'])
|
results_elem.Update('Slider = %s'%values['slider'])
|
||||||
|
|
||||||
g.MsgBox('Done... exiting')
|
rg.MsgBox('Done... exiting')
|
||||||
|
|
|
@ -3043,7 +3043,17 @@ def GetPathBox(title, message, default_path='', button_color=None, size=(None, N
|
||||||
return True, path
|
return True, path
|
||||||
|
|
||||||
|
|
||||||
def PopupGetFolder(message, default_path='', button_color=None, size=(None, None)):
|
def PopupGetFolder(message, default_path='', no_window=False, button_color=None, size=(None, None)):
|
||||||
|
if no_window:
|
||||||
|
root = tk.Tk()
|
||||||
|
try:
|
||||||
|
root.attributes('-alpha', 0) # hide window while building it. makes for smoother 'paint'
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
folder_name = tk.filedialog.askdirectory() # show the 'get folder' dialog box
|
||||||
|
root.destroy()
|
||||||
|
return folder_name
|
||||||
|
|
||||||
with FlexForm(title=message, auto_size_text=True, button_color=button_color) as form:
|
with FlexForm(title=message, auto_size_text=True, button_color=button_color) as form:
|
||||||
layout = [[Text(message, auto_size_text=True)],
|
layout = [[Text(message, auto_size_text=True)],
|
||||||
[InputText(default_text=default_path, size=size), FolderBrowse()],
|
[InputText(default_text=default_path, size=size), FolderBrowse()],
|
||||||
|
@ -3078,10 +3088,17 @@ AskForFile = GetFileBox
|
||||||
|
|
||||||
def PopupGetFile(message, default_path='',save_as=False, no_window=False, file_types=(("ALL Files", "*.*"),), button_color=None, size=(None, None)):
|
def PopupGetFile(message, default_path='',save_as=False, no_window=False, file_types=(("ALL Files", "*.*"),), button_color=None, size=(None, None)):
|
||||||
if no_window:
|
if no_window:
|
||||||
|
root = tk.Tk()
|
||||||
|
try:
|
||||||
|
root.attributes('-alpha', 0) # hide window while building it. makes for smoother 'paint'
|
||||||
|
except:
|
||||||
|
pass
|
||||||
if save_as:
|
if save_as:
|
||||||
return tk.filedialog.asksaveasfilename(filetypes=file_types) # show the 'get file' dialog box
|
filename = tk.filedialog.asksaveasfilename(filetypes=file_types) # show the 'get file' dialog box
|
||||||
else:
|
else:
|
||||||
return tk.filedialog.askopenfilename(filetypes=file_types) # show the 'get file' dialog box
|
filename = tk.filedialog.askopenfilename(filetypes=file_types) # show the 'get file' dialog box
|
||||||
|
root.destroy()
|
||||||
|
return filename
|
||||||
|
|
||||||
if save_as:
|
if save_as:
|
||||||
browse_button = SaveAs(file_types=file_types)
|
browse_button = SaveAs(file_types=file_types)
|
||||||
|
|
Loading…
Reference in New Issue